﻿using System;

namespace Myotragus.Data.Domain
{
	[Serializable]
	public class TextKey : IEquatable<TextKey>
	{
		public int TextId { get; set; }

		public int LcId { get; set; }

		#region IEquatable<TextKey> Members

		public bool Equals(TextKey other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;

			return other.TextId == TextId && other.LcId == LcId;
		}

		#endregion IEquatable<TextKey> Members

		public override bool Equals(object obj)
		{
			if (ReferenceEquals(null, obj)) return false;
			if (ReferenceEquals(this, obj)) return true;

			return obj.GetType() == typeof(TextKey) && Equals((TextKey)obj);
		}

		public override int GetHashCode()
		{
			unchecked
			{
				return (TextId.GetHashCode() * 397) ^ LcId;
			}
		}

		public static bool operator ==(TextKey left, TextKey right)
		{
			return Equals(left, right);
		}

		public static bool operator !=(TextKey left, TextKey right)
		{
			return !Equals(left, right);
		}
	}
}